public subroutine FlowAccumulation(fdir, facc)
compute map of flow accumulation (m2)
Input grid: flow direction
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
type(grid_integer),
|
intent(in) |
|
|
:: |
fdir |
|
type(grid_real),
|
intent(out) |
|
|
:: |
facc |
|
Variables
Type |
Visibility | Attributes |
|
Name |
| Initial | |
integer,
|
public |
|
:: |
i |
|
|
|
integer,
|
public |
|
:: |
j |
|
|
|
Source Code
SUBROUTINE FlowAccumulation &
!
(fdir, facc)
IMPLICIT NONE
!arguments with intent in
TYPE(grid_integer), INTENT(in):: fdir
!arguments with intent out
TYPE (grid_real), INTENT (out) :: facc
!local variables
INTEGER :: i,j
!------------------------------end of declaration -----------------------------
!allocate new flow accumulation grid using flow direction grid as template
CALL NewGrid (facc, fdir)
!compute grid containing area of each cell
DO i = 1, fdir % idim
DO j = 1, fdir % jdim
IF (fdir % mat (i,j) /= fdir % nodata) THEN
facc % mat(i,j) = CellArea (facc, i, j)
ELSE
facc % mat(i,j) = facc % nodata
END IF
END DO
END DO
DO i = 1, fdir % idim
DO j = 1, fdir % jdim
IF (fdir % mat (i,j) /= fdir % nodata) THEN
CALL BasinArea (i, j, fdir, facc % mat(i,j))
ELSE
facc % mat(i,j) = facc % nodata
END IF
END DO
END DO
END SUBROUTINE FlowAccumulation